<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateArticlesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //文章
        Schema::create('articles', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('article_categories_id')->comment("类别id");
            $table->string('title',200)->comment('文章标题');
            $table->string('abstract',255)->default('')->comment('文章摘要');
            $table->string('pic',100)->default('')->comment('文章封面');
            $table->string('author',100)->default('')->comment('文章作者');
            $table->string('source',100)->default('')->comment('文章来源');
            $table->tinyInteger("recommend")->default(0)->comment("是否推荐[否,是]");
            $table->unsignedInteger('praise')->default(0)->comment("点赞量");
            $table->unsignedInteger('pv')->default(0)->comment("浏览量");
            $table->tinyInteger("top")->default(0)->comment("是否置顶[否,是]");
            $table->tinyInteger("status")->default(0)->comment("状态[0正常,1草稿]");


            $table->text('body')->comment('文章内容');

            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('articles');
    }
}
